package models

import (
	"time"
)

type Execution struct {
	Id string `orm:"pk"`

	AgentId *Agent `orm:"column(agent_id);rel(fk)"`
	FlowId  *Flow  `orm:"column(flow_id);rel(fk)"`

	DeploymentId *AgentDeployment `orm:"column(agent_deployment_id);rel(fk)"`

	AgentName      string
	HostName       string
	FlowName       string
	DeploymentName string
	Parameters     string
	Status         string
	StartTime      time.Time `orm:"column(start_time);type(datetime)"`
	EndTime        time.Time `orm:"column(end_time);type(datetime)"`
	CreateTime     time.Time `orm:"column(create_time);type(datetime)"`
	CreateBy       string
	LastUpdateBy   string
	LastUpdateTime time.Time `orm:"column(last_update_time);type(datetime)"`
}

type ExecutionStep struct {
	Id string `orm:"pk"`

	ExecutionId      *Execution `orm:"column(execution_id);rel(fk)"`
	ThreadNumber     int32
	FlowStepId       *FlowStep `orm:"column(flow_step_id);rel(fk)"`
	ComponentName    string
	ApproximateOrder int32
	Status           string
	MessagesReceived int32
	MessagesProduced int32

	PayloadReceived int32
	PayloadProduced int32

	EntitiesProcessed int32

	StartTime time.Time `orm:"column(start_time);type(datetime)"`
	EndTime   time.Time `orm:"column(end_time);type(datetime)"`

	HandleDuration int32
	QueueDuration  int32
}
